
macro_rules! get {
    ($slice: expr, $idx: expr) => {
        unsafe { $slice.get_unchecked($idx) }
    };
    (^$slice: expr, $idx: expr) => {
        $slice.get_unchecked($idx)
    };
}

macro_rules! get_mut {
    ($slice: expr, $idx: expr) => {
        unsafe { $slice.get_unchecked_mut($idx) }
    };
    (^$slice: expr, $idx: expr) => {
        $slice.get_unchecked_mut($idx)
    };
}

macro_rules! chg {
    ($($obj: expr, $field: tt, $value: expr, $raw: expr), +) => {
        $(
            $raw = Rc::into_raw($obj) as *mut Node<K, V>;
            unsafe {
                (*$raw).$field = $value;
                $obj = Rc::from_raw($raw);
            }
        )+
    };
    ($(@$obj: expr, $field: tt, $value: expr, $raw: expr), +) => {
        $(
            $raw = Rc::into_raw($obj) as *mut Node<K, V>;
            unsafe {
                (*$raw).$field = $value;
                Rc::from_raw($raw);
            }
        )+
    };
    ($($obj: expr, $field: tt, $value: expr), +) => {
        let mut raw;
        $(
            raw = Rc::into_raw($obj) as *mut Node<K, V>;
            unsafe {
                (*raw).$field = $value;
                $obj = Rc::from_raw(raw);
            }
        )+
    };
    ($(@$obj: expr, $field: tt, $value: expr), +) => {
        let mut raw;
        $(
            raw = Rc::into_raw($obj) as *mut Node<K, V>;
            unsafe {
                (*raw).$field = $value;
                Rc::from_raw(raw);
            }
        )+
    };
    ($(^$obj: expr, $field: tt, $value: expr, $raw: expr), +) => {
        $(
            $raw = Rc::into_raw($obj) as *mut Node<K, V>;
            (*$raw).$field = $value;
            $obj = Rc::from_raw($raw);
        )+
    };
    ($(^@$obj: expr, $field: tt, $value: expr, $raw: expr), +) => {
        $(
            $raw = Rc::into_raw($obj) as *mut Node<K, V>;
            (*$raw).$field = $value;
            Rc::from_raw($raw);
        )+
    };
    ($(^$obj: expr, $field: tt, $value: expr), +) => {
        let mut raw;
        $(
            raw = Rc::into_raw($obj) as *mut Node<K, V>;
            (*raw).$field = $value;
            $obj = Rc::from_raw(raw);
        )+
    };
    ($(^@$obj: expr, $field: tt, $value: expr), +) => {
        let mut raw;
        $(
            raw = Rc::into_raw($obj) as *mut Node<K, V>;
            (*raw).$field = $value;
            Rc::from_raw(raw);
        )+
    };
}

